home *** CD-ROM | disk | FTP | other *** search
/ Network Support Library / RoseWare - Network Support Library.iso / btrieve / btr61m.exe / 04CH1.TXT < prev    next >
Text File  |  1993-07-16  |  21KB  |  612 lines

  1. CHAPTER 1 INTRODUCTION TO BTRIEVE
  2.  
  3. Btrieve is a key-indexed record management system designed
  4. for high-performance data handling and improved programming
  5. productivity.  Btrieve allows your application to retrieve,
  6. insert, update, or delete records either by key value or by
  7. sequential or random access methods.
  8.  
  9.  
  10. Client-Server Design
  11.  
  12. Btrieve products include server-based Btrieve (also
  13. called NetWare Btrieve¬) and client-based Btrieve.  In
  14. most cases, applications written for client-based
  15. Btrieve can run on server-based Btrieve and vice versa.
  16.  
  17. Server-based Btrieve is provided with the NetWare
  18. operating system and includes the following:
  19.  
  20. o Server-based Btrieve Record Manager, which runs at the
  21.   server and manages data I/O with the file system.
  22.  
  23. o Btrieve communications programs, which handle incoming
  24.   requests from a remote source and which can route requests
  25.   from a server-based application to a copy of the Record
  26.   Manager running on a remote server.
  27.  
  28. o Btrieve Requesters, which run at the workstation and
  29.   handle data I/O between the workstation and the server.
  30.   The Requesters allow applications running at the
  31.   workstation to communicate transparently with the Record
  32.   Manager.  Btrieve Requesters are available for DOS, OS/2,
  33.   Windows, and UnixWare¬ workstations.
  34.  
  35. o Btrieve utilities, which provide setup, rebuild, monitor,
  36.   maintenance, and recovery programs for Btrieve users and
  37.   files.
  38.  
  39. o This manual, which documents using Btrieve in a NetWare
  40.   environment.
  41.  
  42. Client-based Btrieve is available only as part of a
  43. Btrieve Developer's Kit (DOS, OS/2, or Windows), which
  44. must be purchased separately.  Each Btrieve
  45. Developer's Kit includes the following:
  46.  
  47. o Client-based Record Manager for the applicable
  48.   environment (DOS, OS/2, or Windows).  The client-based
  49.   Record Manager executes all processing on the workstation.
  50.   It accesses all files through operating system calls.  The
  51.   operating system calls are either executed locally (for
  52.   local files) or redirected to the server (for files on the
  53.   server).
  54.  
  55. o Btrieve utilities, which provide setup, rebuild (Btrieve
  56.   v5.x to v6.x files), monitor, maintenance, and recovery
  57.   programs for Btrieve users and files.
  58.  
  59. o An installation and operation manual, which documents
  60.   using Btrieve in the applicable environment (DOS, OS/2, or
  61.   Windows).
  62.  
  63. o Btrieve Programmer's Manual, which documents the
  64.   Application Programming Interface (API) and the language
  65.   interfaces that allow Btrieve to be called from various
  66.   programming languages.
  67.  
  68.  
  69. Btrieve Features
  70.  
  71. The following sections introduce some of the features
  72. that make Btrieve a uniquely powerful record
  73. management system.  Index MaintenanceBtrieve
  74. automatically creates and maintains file indexes as
  75. records are inserted, updated, and deleted.  In
  76. addition to automatic index maintenance, Btrieve
  77. supports the following index features:
  78.  
  79. o Up to 119 key segments per file
  80.  
  81. o Adding or dropping any index after a file has been created
  82.  
  83. o Numerous data types for key values:  integer, float,
  84.   date, time, decimal, money, logical, numeric, bfloat,
  85.   string, lstring, zstring, unsigned binary, autoincrement,
  86.   and sign trailing separate
  87.  
  88. o Numerous key attributes:  linked/repeating duplicatable,
  89.   duplicatable/nonduplicatable, supplemental,
  90.   modifiable/nonmodifiable, segmented/nonsegmented,
  91.   descending/ascending sorting,
  92.   case-sensitive/case-insensitive sorting, alternate
  93.   collating sequence, null
  94.   (any-segment/all-segment)/non-null
  95.  
  96.  
  97. File Specifications
  98.  
  99. Btrieve offers these file specifications :
  100.  
  101. o File sizes up to 4 billion bytes (4 gigabytes)
  102.  
  103. o Number of records limited only by the size limit of the
  104.   file
  105.  
  106. o Consistent file definition and management routines
  107.   independent of the operating environment
  108.  
  109. o Consistent file structures
  110.  
  111.  
  112. Memory Management
  113.  
  114. The cache is an area of memory Btrieve reserves for
  115. buffering the pages that it reads.  When your
  116. application requests a record, Btrieve first checks
  117. the cache to see if the page containing that record is
  118. already in memory.  If so, Btrieve transfers the
  119. record from the cache to your application's data
  120. buffer.  If the page is not in the cache, Btrieve
  121. reads the page from the disk into a cache buffer
  122. before transferring the requested record to your
  123. application.
  124.  
  125. If every cache buffer is full when Btrieve needs to
  126. transfer a new page into memory, a least-recently-used
  127. (LRU) algorithm determines which page in the cache
  128. Btrieve should overwrite.  The LRU algorithm reduces
  129. processing time by keeping the most recently
  130. referenced pages in memory.
  131.  
  132. Generally, a larger cache improves performance because
  133. it allows more pages to be in memory at a given time.
  134. Btrieve allows you to specify the amount of memory to
  135. reserve for the I/O cache buffers.  To determine this
  136. amount of memory, consider your application memory
  137. requirements (if your application is an NLM), the
  138. total amount of memory installed on your server, and
  139. the combined size of all files your application will
  140. access.
  141.  
  142.  
  143. Data Integrity
  144.  
  145. The following Btrieve features will let you support
  146. concurrent access while ensuring the integrity of your
  147. files in a multiuser environment:
  148.  
  149. o Single-record and multiple-record locks.
  150.  
  151. o Concurrent and exclusive transactions.  (See "Concurrent
  152.   Transactions.")
  153.  
  154. o Deadlock detection (in a server-based environment).
  155.  
  156. o Shadow paging, which entails making changes to a copy of
  157.   a page's image rather than changing the original page when
  158.   inserting, updating, or deleting a record.  (See "Shadow
  159.   Paging.")
  160.  
  161. o Logging feature, which records (in a log file) any
  162.   changes made to a designated file.
  163.  
  164. o Roll Forward utility, which uses log files maintained by
  165.   Btrieve's logging feature to recover data corrupted by a
  166.   system or server failure.
  167.  
  168.  
  169. Security Controls
  170.  
  171. Btrieve provides the following capabilities for
  172. enhancing data security in a network environment:
  173.  
  174. o Assigning owner names to filesu Specifying dynamic
  175.   encryption and decryption of data
  176.  
  177. o Providing NetWare file-level security (provided through
  178.   the Btrieve Requesters)
  179.  
  180.  
  181. Enhancements to Btrieve
  182.  
  183. Btrieve v6.x provides several new features and
  184. performance enhancements that support the requirements
  185. of today's powerful database management systems.  The
  186. following sections describe these enhancements.The
  187. first section describes the enhancements that apply
  188. only to Btrieve v6.1.  The second section describes
  189. enhancements that apply to Btrieve v6.x (that is, to
  190. both v6.0 and v6.1).
  191.  
  192.  
  193. Btrieve v6.1 Enhancements
  194.  
  195. This section describes enhancements to Btrieve that
  196. apply to v6.1.
  197.  
  198.  
  199. Support for Operating on a Portion of a Record: Chunks
  200.  
  201. Btrieve v6.1 allows you to operate on portions of a
  202. record, called chunks, rather than on the entire
  203. record.  This enhancement provides new chunk
  204. operations that work on any file conforming to the
  205. Btrieve v6.x file format.
  206.  
  207.  
  208. New Operations to Support Records Larger than 64 KB
  209.  
  210. Through the use of the Get Direct/Chunk (23) and Update
  211. Chunk (53) operations, Btrieve v6.1 supports records
  212. larger than 64 KB.  Applications can use chunk
  213. operations to build records larger than 64 KB in any
  214. Btrieve v6.x file that allows variable-length records.
  215.  
  216.  
  217. New File Structure to Support Very Long Records
  218.  
  219. Btrieve v6.1 also allows an application to create
  220. Btrieve files that contain structures called
  221. Variable-tail Allocation Tables (VATs).  VATs speed
  222. Btrieve's access to the data residing at large offsets
  223. in very long records.  VATs also significantly reduze
  224. the size of buffers needed by Btrieve to process
  225. records in files that use data compression.
  226.  
  227.  
  228. Multiple Alternate Collating Sequences
  229.  
  230. Btrieve v6.1 allows you to specify a separate alternate
  231. collating sequence (ACS) for each key in a file.
  232. Btrieve files with multiple keys are no longer
  233. restricted to having only one ACS.
  234.  
  235.  
  236. Locale-Specific Collating Sequences
  237.  
  238. Btrieve v6.1 allows you to instruct Btrieve to build an
  239. ACS that is sensitive to the specified locale's
  240. character sorting order.  This ability allows Btrieve
  241. to sort according to a character set specified by a
  242. particular country ID and code page.
  243.  
  244.  
  245. Index Balancing
  246.  
  247. When an index page becomes full, Btrieve automatically
  248. creates a new index page and splits the values in the
  249. full page between the two pages.  Btrieve v6.1 now
  250. offers the option of using index balancing instead.
  251.  
  252. When you use index balancing, Btrieve looks for
  253. available space in other index pages associated with
  254. the same key each time an index page becomes full.
  255. Btrieve then rotates values from the full page into
  256. the pages that have space available.  Index balancing
  257. increases index page utilization, results in fewer
  258. pages, and produces an even distribution of keys among
  259. nodes on the same level.
  260.  
  261.  
  262. Performing Reads While Creating an Index
  263.  
  264. With Btrieve v6.1, you can perform reads while a Create
  265. Index operation (13) is executing.  Previous versions
  266. of Btrieve locked the entire file when executing a
  267. Create Index operation.
  268.  
  269.  
  270. New Data Type
  271.  
  272. Btrieve v6.1 allows you to specify a new data type for
  273. keys called sign trailing separate (STS).  STS is a
  274. COBOL data type.  Basically a numeric data type, it is
  275. represented as an ASCII string that is right-justified
  276. and padded with zeros.
  277.  
  278.  
  279. Percentage Operations
  280.  
  281. Btrieve v6.1 provides two new operations that a
  282. window-oriented application can use for implementing
  283. scroll bars.The Find Percentage (45) operation finds
  284. the position of a record either relative to a key path
  285. or as the record╒s physical location within the file.
  286. The position is expressed as a percentage value.
  287.  
  288. The Get By Percentage (44) operation retrieves a record by
  289. that record╒s position in the Btrieve file, where the
  290. position is based on a percentage value you supply when you
  291. call the operation.  You can specify whether the position is
  292. relative to a specified key path, or represents the
  293. record's actual physical location in the file.
  294.  
  295.  
  296. No Currency Change
  297.  
  298. Btrieve v6.1 provides a No Currency Change option on
  299. inserts and updates.  In previous versions of Btrieve,
  300. positioning was reestablished based on the key value of the
  301. inserted or updated record.
  302.  
  303.  
  304. New Ability to Specify Repeating- or Linked-Duplicatable Keys
  305. on Create Operations
  306.  
  307. On the Create (14) and Create Index (31) operations,
  308. Btrieve v6.1 allows you to specify a key as either a
  309. repeating-duplicatable key or a linked-duplicatable
  310. key.
  311.  
  312.  
  313. Improved Btrieve Requesters
  314.  
  315. The Btrieve DOS and OS/2 Requesters now support MAP
  316. ROOT drives and NetWare file-level security.  Since
  317. the Windows Requester requires the DOS Requester,
  318. Windows users can also take advantage of these
  319. features.  When opening files in a NetWare v3.11
  320. environment, Btrieve Requesters provide enhanced
  321. performance by reducing the bindery access for each
  322. file and reducing network traffic in general.
  323.  
  324. The Btrieve v6.1 Requesters have three new features:
  325.  
  326. o Automatic support for double-byte character environments
  327.  
  328. o Support for the NetWare Runtime serialized NetWare
  329.   operating system
  330.  
  331. o Optional compression of data prior to network
  332.   transmission
  333.  
  334. NOTE:  Btrieve now provides a requester for the
  335. UnixWare environment.  For information about this new
  336. UnixWare Requester, please refer to the Readme file
  337. that accompanies this release.
  338.  
  339.  
  340. Btrieve 6.x Enhancements
  341.  
  342. This section describes ehancements that apply to
  343. Btrieve v6.x (that is, to Btrieve v6.0 and Btrieve
  344. v6.1).
  345.  
  346.  
  347. New File Format
  348.  
  349. When creating files, Btrieve v6.x uses a new file
  350. format that allows faster data access than was possible
  351. with previous Btrieve versions.  This format,
  352. introduced in Btrieve v6.0 and modified slightly in
  353. Btrieve v6.1, is responsible for many of the
  354. enhancements and new features available with these
  355. releases.
  356.  
  357. Btrieve v6.0 operates on any file created with Btrieve
  358. v6.1 unless that file uses v6.1 features that altered
  359. the Btrieve file format (such as multiple ACSs and
  360. VATs).
  361.  
  362. Pre-6.x versions of Btrieve cannot open files that
  363. have a v6.x format.  However, Btrieve v6.x can open
  364. files created with earlier versions of Btrieve.  When
  365. Btrieve v6.x opens files from earlier versions, it
  366. does not convert the files to the v6.x format.
  367.  
  368. The Create Btrieve Files in Pre v6.x Format
  369. configuration option is useful if you must use
  370. newly-created files with versions of Btrieve prior to
  371. v6.0.
  372.  
  373.  
  374. Online Backups
  375.  
  376. Through a feature called continuous operation, Btrieve
  377. v6.x now lets you back up Btrieve files while they are
  378. open and in use.  This feature is important for
  379. applications that conduct transactions 24 hours a
  380. day.When you enable the continuous operation feature,
  381. Btrieve opens each original file in read-only,
  382. shareable mode to allow backup utilities to access the
  383. file's static image.  Any changes to the original file
  384. that occur during the backup are stored in a temporary
  385. file called a delta file.  When the backup ends,
  386. Btrieve automatically updates the original file with
  387. the changes from the delta file and then deletes the
  388. temporary delta file.
  389.  
  390.  
  391. Concurrent Transactions
  392.  
  393. Concurrent transactions allow one or more applications
  394. to run multiple transactions simultaneously for the
  395. same Btrieve file (if the file uses the Btrieve v6.x
  396. format).Versions of Btrieve prior to v6.0 support only
  397. one type of transaction:  exclusive.  When an
  398. application reads, updates, inserts, or deletes a
  399. record from a file in an exclusive transaction,
  400. Btrieve locks the entire file for the duration of the
  401. transaction.  This type of locking is known as
  402. file-level transaction locking.
  403.  
  404. Once a file is locked in an exclusive transaction,
  405. other users can still read the file, provided they are
  406. not involved in exclusive transactions and are not
  407. attempting to lock the file themselves.  They cannot,
  408. however, make any changes to the file.
  409.  
  410. If the file uses the Btrieve v6.x format, other users
  411. will not see changes that occur during the transaction
  412. until that transaction ends.  (If the file uses the
  413. Btrieve v5.x file format, other users can see such
  414. changes.)
  415.  
  416. In addition to supporting exclusive transactions,
  417. Btrieve v6.x supports a new type of transaction:
  418. concurrent.  When a Btrieve v6.x file is included in a
  419. concurrent transaction, modifications cause Btrieve to
  420. lock only the page (or pages, if the record is
  421. variable length) that contains the record, as well as
  422. its associated index pages.
  423.  
  424. This allows other users to modify or include the same
  425. file in their own concurrent transaction, as long as
  426. no concurrent has already locked the pages that
  427. contain the records to be modified (or any affected
  428. index pages).
  429.  
  430. Concurrent transactions have the following additional
  431. features:
  432.  
  433. o Locked pages remain locked for the duration of the
  434.   transaction.
  435.  
  436. o If the transaction simply reads a record, Btrieve does
  437.   not lock the corresponding page (unless a read lock is
  438.   applied).
  439.  
  440. o Other users can read the data on the locked pages;
  441.   however, they cannot lock the pages (by updating or
  442.   applying an explicit read lock).
  443.  
  444. o Other users cannot see the changes to a file in a
  445.   transaction until the transaction ends.  (That way, if a
  446.   system failure occurs before the transaction completes,
  447.   other users will not have read false data--that is, data
  448.   that will be rolled back.)
  449.  
  450. NOTE:  For compatibility, Btrieve v6.x continues to
  451. support exclusive transactions, but with one
  452. difference from previous versions:  if the exclusive
  453. transaction affects Btrieve v6.x files, other users
  454. cannot see the changes to those files until the
  455. transaction ends.
  456.  
  457.  
  458. Shadow Paging
  459.  
  460. With Btrieve file versions prior to v6.0, Btrieve uses
  461. pre-imaging to protect files from corruption in case
  462. of a system failure.  Before updating a file, Btrieve
  463. creates a temporary pre-image file.  This file
  464. contains the pages to be updated from the original
  465. file.  Btrieve then performs the update on the
  466. original file.  If the system fails during the update,
  467. Btrieve can restore the original file using the
  468. pre-image file.
  469.  
  470. A new Btrieve v6.x page handling technique called
  471. shadow paging has replaced pre-imaging.  When a user
  472. needs to change a page (either inside or outside a
  473. transaction), Btrieve creates a shadow page- a virtual
  474. copy of the original page within the same Btrieve
  475. file.  Btrieve then makes the changes to the shadow
  476. page instead of the original.  When the changes are
  477. committed (either when the operation is complete or the
  478. transaction ends), Btrieve designates the shadow page
  479. as the current page, and the original page becomes
  480. available for reuse.  If a system failure occurs
  481. before the changes are committed, Btrieve drops the
  482. shadow page, and the current page remains in its
  483. original condition.
  484.  
  485. With shadow paging, each user works with a virtual
  486. copy of the page.  Consequently, two users can access
  487. the same logical page, and neither user sees the other
  488. user's changes until the operation or transaction is
  489. complete.  Also, shadow paging enhances reliability
  490. because the original file is always valid and
  491. internally consistent.
  492.  
  493.  
  494. New Caching Algorithms
  495.  
  496. Btrieve v6.x provides new caching algorithms that
  497. improve memory management for concurrent users.  These
  498. new algorithms include hashing search methods for
  499. improved access, concurrent sharing of a single cahe,
  500. and use of existing cache across operations.
  501.  
  502.  
  503. Better Usage of Large Data Files
  504.  
  505. Btrieve v6.x provides faster access and more efficient
  506. use of large data files.  With Btrieve v6.x, you can
  507. create additional indexes for large data files more
  508. quickly than in previous versions, and new merge sorts
  509. take advantage of whatever cache is available.
  510.  
  511.  
  512. Up to 119 Key Segments
  513.  
  514. Btrieve v6.x supports up to 119 key segments in files
  515. with a page size of 4,096 bytes.  The maximum number
  516. of key segments you can define for a file depends on
  517. the file's page size.  Versions of Btrieve prior to
  518. v6.0 supported a maximum of 24 key segments.
  519.  
  520.  
  521. Adding and Dropping Any Index
  522.  
  523. Btrieve v6.x supports adding and dropping any index.
  524. (In versions prior to Btrieve v6.0, you could add and
  525. drop only supplemental indexes.) Also, you can drop
  526. indexes without renumbering the remaining indexes.
  527.  
  528.  
  529. Specific Key Numbers Allowed When Creating a File or Index
  530.  
  531. Btrieve v6.x allows an application to assign specific
  532. key numbers when creating a v6.x format file with
  533. indexes, or when creating an index for a preexisting
  534. v6.x file.
  535.  
  536.  
  537. Optional Renumbering of Keys
  538.  
  539. With Btrieve v6.x, the Drop Index operation (32)
  540. allows an application to specify whether to renumber
  541. the remaining keys when an index is dropped from a
  542. Btrieve file.  (Note that the file must use the
  543. Btrieve v6.x format.)
  544.  
  545.  
  546. Enhanced Support for Case-Insensitive Keys
  547.  
  548. With Btrieve v6.x, you can create case-insensitive keys
  549. without using an alternate collating sequence.  When
  550. creating a file, you can use the key specifications to
  551. specify case-insensitive keys.  With case-insensitive
  552. keys, the letter a is sorted the same as the letter A.
  553.  
  554.  
  555. Enhancement to autoincrement Key
  556.  
  557. In Btrieve v6.x, you can initialize the value of a
  558. field in every record of a file to zero and later add
  559. an index of type autoincrement.  This feature allows
  560. you to prepare for an autoincrement key without
  561. actually building the index until it is needed.
  562.  
  563.  
  564. Reserved Space for Duplicate Pointers
  565.  
  566. Btrieve v6.x allows reserving duplicate pointers on
  567. data records for linked duplicate keys.  When creating
  568. a Btrieve v6.x file, an application can reserve space
  569. in the data records for extra, unused duplicate
  570. pointers.  Later, when an application adds an index
  571. that allows duplicate values, Btrieve stores pointers
  572. to those duplicate values in the reserved space
  573. (unless the Repeating Duplicates key attribute has
  574. been specified).
  575.  
  576.  
  577. Key-Only File Modification
  578.  
  579. With Btrieve v6.x, you can update and delete records in
  580. key-only files.  In versions of Btrieve prior to v6.0,
  581. you could only insert records.
  582.  
  583.  
  584. New Stat Option
  585.  
  586. A new option in the Stat operation (15) allows an
  587. application to obtain additional information such as a
  588. file's Btrieve version and the number of unused
  589. duplicate pointers.  This feature also works with
  590. files created with previous versions of Btrieve.
  591.  
  592.  
  593. Locking in Extended Operations
  594.  
  595. Unlike previous versions of Btrieve, v6.x allows an
  596. application to use locks on the extended operations:
  597. Get Next Extended (36), Get Previous Extended (37),
  598. Step Next Extended (38), and Step Previous Extended
  599. (39).
  600.  
  601.  
  602. Support for Referential Integrity
  603.  
  604. Btrieve v6.x supports the use of referential integrity
  605. (RI) constraints created through Novell's NetWare SQL
  606. relational data access system.  RI ensures that
  607. dependent data stays synchronized throughout the
  608. database.  No Btrieve operations currently exist to
  609. manipulate RI constraints directly; you must use
  610. NetWare SQL.
  611.  
  612.